package main

import (
	"fmt"

	"doubimeizhi.com/utility"
	_ "openapi/chinaregion"
	_ "openapi/ip"
	_ "openapi/routers"

	"github.com/astaxie/beego"
	log "github.com/cihub/seelog"
)

func main() {
	if !utility.CheckAndRecordPid("openapi_server.pid") {
		fmt.Println("process already exists, so quit")
		return
	}
	logger, err := log.LoggerFromConfigAsFile("conf/seelog.xml")
	if err != nil {
		panic(err)
		return
	}
	log.ReplaceLogger(logger)
	defer logger.Flush()

	beego.Run()
	log.Error("Server quit!")
}
